import store from '@/store';

export const hasPermission = (flag) => {
  let permission = [];
  let result = false;
  if (store.state.user.user_info.permissions && store.state.user.user_info.permissions.length > 0) {
    permission = [...store.state.user.user_info.permissions];
    for (let i = 0; i < permission.length; i++) {
      if (permission[i] === flag) {
        result = true;
        break;
      }
    }
  }
  return result;
}
